Music Object Version 3.0.0
RELEASE DATE: 1999-02-10
|
|
|
What's New In This Version
|
In the interest of developing the Music Object API into a robust API for Web page sonification, and also a possible candidate for standardization as a module for the ECMA-262 scripting language, Beatnik Inc. has made some noteworthy changes to the API. These changes may require that some of your sonified content be updated in order to use the 3.0.x version of Music Object.
|
A Change in Name : "musicObject" Becomes "Music"
|
The object name "musicObject" has been changed to just "Music".
- Why?
This is to bring the Music Object API in line with current objects built into the JavaScript language. The object name's first letter is capitalized, in the spirit of other built-in objects, such as "Math", "Image", etc. It is also the common convention that object constructor names be capitalized in this way. And, since the capitalization of the first letter indicates that "Music" is an object constructor, it is then redundant to append "Object" to its name.
- Backward Compatibility?
Initially, there will be several versions of the file "music-object.js" where using the constructor name "musicObject" will still work and will have the same effect as using the new "Music" constructor. However, this backward compatibility will not be maintained indefinitely. If you have code that you do not wish to change, you should either continue to use the old "music-object.js" that has worked with your content, or you should use the new version and make the necessary updates to your code.
- How to Update Code
Updating your code for this change in the constructor name should be a simple matter of performing a search-and-replace in a good text editor. For comprehensive update guidelines, see the section Migrating Content from Music Object 2.x to 3.0.x.
To recap, the change in the object constructor name is primarily to make the Music Object API look similar to, and fit in well with the other objects that are already built into the JavaScript language.
With Music Object 3.0, it is now possible to call global utility methods by directly dereferencing the Music Object constructor. All global functions of the Music Object API that were prefixed with "mo_" are now referenced as methods of "Music". So, for example, the global Music Object API function "mo_isPlayerCompatible" is now called as "Music.isPlayerCompatible".
While the definition in some programming languages of a "static method" means that it may be called as a method of any instance of the object class, this is not the case with JavaScript. Static methods, as implemented in the Music Object API, can only be called as methods of the "Music" object constructor and not instances of the "Music" object that have been created.
The table below lists the old global Music Object API functions and their new names as static methods of "Music".
| Global Function |
Static&Method Name |
Backward Compatible |
| mo_magicEmbed |
Music.magicEmbed |
yes (deprecated) |
| mo_installBeatnik |
Music.installPlayer |
yes (deprecated) |
| mo_isPlayerCompatible |
Music.isPlayerCompatible |
yes (deprecated) |
| mo_hasMinVersion |
Music.hasMinVersion |
yes (deprecated) |
| mo_promptClose |
Music.promptClose |
yes (deprecated) |
| mo_promptUser |
Music.promptUser |
yes (deprecated) |
| mo_getNoteName |
Music.getNoteName |
yes (deprecated) |
| mo_getNoteNumber |
Music.getNoteNumber |
yes (deprecated) |
|
|
The highlighted static method names indicate names that differ significantly from their original forms.
- Why?
The goal of converting the Music Object API's global functions into static methods of the "Music" object constructor is to create as self-contained an API as possible, without the need to use more of the global namespace. If all of the API could be wrapped into "Music", this would be ideal.
- Backward Compatibility?
While initially the global "mo_" namespace will still be used for backward compatibility reasons, the objective is to get content authors to switch over to using the static methods of "Music" so that at some point in the future the deprecated "mo_" global functions can be removed from the API.
Initially, there will be several versions of the file "music-object.js" where using the global "mo_" functions will still work and will have the same effect as using the static methods of "Music". However, this backward compatibility will not be maintained indefinitely. As soon as you start using Music Object 3.0, you should make the necessary changes to your scripting so as to make use of the static methods and not the global functions.
- How to Update Code
Updating your code for this change should be quite easy. It is highly probable that the only functions being called in your own scripting that are prefixed with "mo_" will be the global functions of the Music Object API that are becoming static methods of "Music". You can then simply perform a search-and-replace in a good text editor to change all occurrences of "mo_" with "Music.". One exception is the "mo_installBeatnik" function which has changed name and should now be called as "Music.installPlayer". For comprehensive update guidelines, see the section Migrating Content from Music Object 2.x to 3.0.x.
In a similar vein to the new static methods, all properties of the Music Object API that were available as global variables prefixed with "mo_" are now dereferenced as static properties of the "Music" object constructor. So, for example, the global Music Object API property "mo_debugToStatus" is now used in the form "Music.debugToStatus".
While the definition in some programming languages of a "static property" means that it may be referenced as a property of any instance of the object class, this is not the case with JavaScript. Static properties, as implemented in the Music Object API, can only be referenced as properties of the "Music" object constructor and not from instances of the "Music" object that have been created.
The table below lists the old global Music Object API properties and their new names as static properties of "Music".
| Global Property |
Static Property Name |
Backward Compatible |
| mo_debugToAlert |
Music.debugToAlert |
no |
| mo_debugToJavaConsole |
Music.debugToJavaConsole |
no |
| mo_debugToStatus |
Music.debugToStatus |
no |
| mo_ignoreNotReady |
Music.ignoreNotReady |
no |
| mo_ignoreJavaDisabled |
Music.ignoreJavaDisabled |
no |
| mo_requiredMinVersion |
Music.requiredMinVersion |
no |
| mo_showCompatibilityPrompt |
Music.showCompatibilityPrompt |
no |
| mo_silentIfInadequate |
Music.silentIfInadequate |
no |
| mo_BeatnikType |
Music.playerType |
no |
| mo_BeatnikVersion |
Music.playerVersion |
no |
| mo_browserSupported |
Music.clientSupported |
no |
| mo_hasBeatnik |
Music.hasPlayer |
no |
| mo_platform |
Music.platform |
no |
| mo_enabled |
Music.enabled |
no |
|
|
The highlighted static property names indicate names that differ significantly from their original forms.
- Why?
The goal of converting the Music Object API's global properties into static properties of the "Music" object constructor is the same as the goal of converting the global functions into static methods of "Music" - to create as self-contained an API as possible. The goal is to wrap as much of the API into "Music" as possible.
- Backward Compatibility?
Unlike the case with the static methods where the old global function forms will still be available to use for some versions to come, the global properties prefixed with "mo_" are no longer available at all in Music Object 3.0. So, if you were using these properties in processes such as compatibility testing, you will have to update your code to use the new static property forms.
- How to Update Code
Updating your code for this change should also be quite easy. It is highly probable that the only properties being used in your own scripting that are prefixed with "mo_" will be the global properties of the Music Object API that are becoming static properties of "Music". You can then simply perform a search-and-replace in a good text editor to change all occurrences of "mo_" with "Music.". Of course, there are several exceptions in the case of the static properties of names that have changed quite dramatically from the original global properties. For comprehensive update guidelines, see the section Migrating Content from Music Object 2.x to 3.0.x.
In the two preceding sections on the new static methods and static properties, you will have noticed that some of the names for the new static versions of the global functions or properties were highlighted. In most cases, all global functions or properties can now be dereferenced from the "Music" object constructor, simply by replacing "mo_" in the name with "Music.". However, it was decided to use this opportunity to also change the names of some of the static methods and properties to make them less Beatnik-specific and more player-neutral.
This is all part of the effort towards gradually evolving the Music Object API into a module that can be standardized for the already established ECMA-262 scripting language standard (a.k.a. JavaScript, JScript, JellyScript). Hopefully in the future, Web browsers will have native support for scriptable interactive music and audio through the Music Object API module.